const path = require('path')
const RemovePlugin = require('remove-files-webpack-plugin')

module.exports = {
	configureWebpack: {
		plugins: [new RemovePlugin({
				before: {
					root: path.join(__dirname, './unpackage'),
					include: [path.join(__dirname, 'unpackage/dist', process.env.NODE_ENV ===
						'production' ?
						'build' : 'dev',
						process.env.UNI_PLATFORM)],
					trash: false
				},
				after: {
					root: path.join(__dirname, './unpackage'),
					include: [path.join(__dirname, 'unpackage/dist', process.env.NODE_ENV ===
						'production' ?
						'build' : 'dev',
						process.env.UNI_PLATFORM, './static/images')],
					trash: false
				}
			}),
			new RemovePlugin({
				before: {
					root: path.join(__dirname, './unpackage'),
					include: [path.join(__dirname, 'unpackage/dist', process.env.NODE_ENV ===
						'production' ?
						'build' : 'dev',
						process.env.UNI_PLATFORM)],
					trash: false
				},
				// after: {
				// 	root: path.join(__dirname, './unpackage'),
				// 	include: [path.join(__dirname, 'unpackage/dist', process.env.NODE_ENV ===
				// 		'production' ?
				// 		'build' : 'dev',
				// 		process.env.UNI_PLATFORM, './.cloudbase')],
				// 	trash: false
				// }
			})
		]
	}
}
